********************************************************************************
clear all
*ssc install blindschemes
*ssc install acreg
*ssc install ranktest
set scheme plotplain 
********************************************************************************
** Load data
********************************************************************************

import delimited "/Users/zerenlinew/Dropbox/hotline_responsiveness/Replication_files/final_data/final_data.csv", clear


global  reg_result "/Users/zerenlinew/Dropbox/hotline_responsiveness/Regression"
* label variables
label var female "Female"
label var local "Local"
label var foregin  "Foreign"
label var price "Price"
label var anonymous "Anonymous"
label var city_twosession "Local Two Sessions"
label var distance_km "Distance to Neighborhood Center"
label var national_twosession "National Two Sessions"
label var local_turnover "Local Turnover"
label var price_l "Price"
label var res_speed "Resolution Time"
label var resolve_0 "Positive Resolution"
label var treatment "Boundary"

* Create factor variable for v_classes

encode v_class1, gen(class_type)

* set variables
global ind_cov female  local  foregin anonymous distance_km
global pol_cov city_twosession  national_twosession local_turnover 

global full_spc_baseline  keep(price_l treatment $ind_cov  $pol_cov res_speed  resolve_0 speed_resolve_int) lab  nocons  dec(3)   // alpha(0.01, 0.05, 0.1)

  
********************************************************************************
* Spatial Corrected Standard Errors
********************************************************************************
global full_spc_baseline  keep(price_l treatment) lab  nocons  dec(3)  
   
  
acreg res_speed   price_l $ind_cov $pol_cov , pfe1(yearmonth)  pfe2(class_type)  ///
 spatial latitude(wgslat) longitude(wgslon) dist(2)  
outreg2  using $reg_result/spatial_se.tex, replace  /// 
  addtext(Type FE, Y, Year-month FE, Y, Controls, Y ) $full_spc_baseline ctitle("OLS")
  
acreg res_speed  $ind_cov $pol_cov (price_l = treatment ), pfe1(yearmonth)  pfe2(class_type)  ///
 spatial latitude(wgslat) longitude(wgslon) dist(2) 
outreg2  using $reg_result/spatial_se.tex, append  /// 
  addtext(Type FE, Y, Year-month FE, Y, Controls, Y ) $full_spc_baseline ctitle("IV")

 

